package net.alpcontrol.bi.colligation.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import net.alpcontrol.bi.colligation.entity.HrmResource;
import net.alpcontrol.bi.colligation.entity.InitialCharge;
import net.alpcontrol.bi.colligation.entity.VJkPzst;
import net.alpcontrol.bi.colligation.mapper.HrmResourceMapper;
import net.alpcontrol.bi.colligation.mapper.VJkPzstMapper;
import net.alpcontrol.bi.colligation.service.IInitialChargeService;
import net.alpcontrol.bi.colligation.service.IVJkPzstService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 丛庆
 * @since 2020-09-28
 */
@Service
@Transactional
public class VJkPzstServiceImpl extends ServiceImpl<VJkPzstMapper, VJkPzst> implements IVJkPzstService {

    @Autowired
    private VJkPzstMapper vJkPzstMapper;

    /**
      *  分页查询
      * @param bootStrapTable
      * @param vJkPzst
      * @return
      */
    @Override
    public IPage<VJkPzst> selectPage(Page<VJkPzst> page) {
        return vJkPzstMapper.selectPage(page,null);
    }

    /**
     * 根据月份、员工名称、公司(用于切换数据源)查询报销凭证
     *
     * @param beginMonth
     * @param endMonth
     * @param companyId
     * @param empInitialList
     * @return
     */
    @DS("#header.tenantName")
    @Override
    public List<Map> listByMonthAndCompany(String beginMonth, String endMonth, String companyId, List empInitialList){
        Map param = new HashMap();
        param.put("beginMonth",beginMonth);
        param.put("endMonth",endMonth);
        param.put("empInitialList",empInitialList);
        return vJkPzstMapper.listByMonthAndCompany(param);
    }

    /**
     * 根据月份、员工名称、公司(用于切换数据源)查询报销凭证
     *
     * @param param
     * @return
     */
    @DS("#header.tenantName")
    @Override
    public List<Map> getInitialChargeByEmpAndMonth(Map param) {
        return vJkPzstMapper.getInitialChargeByEmpAndMonth(param);
    }

}
